//#include <stdlib.h>
#include <stdio.h>
//#include <string.h>
#include <ctype.h>

unsigned long long getNextToken(FILE *fp)
{
	unsigned long long token = 0;
	char c;
	
	c = fgetc(fp);
	
	//run past all previous whitespace in the cipher
	//file until someting else has been seen.
	while(isspace(c) && !feof(fp))
	{
		c = fgetc(fp);
	}
	
	//while seeing digits - make into an unsigned long long
	if(!feof(fp) && isdigit(c))
	{
		do
		{
			token *= 10;
			token += (unsigned long long)c - (unsigned long long)'0';
			c = fgetc(fp);
		}
		while(isdigit(c) && !feof(fp));
		
		return token;
	}
	else
	{
		return 0;
	}
}